package com.chance.cc.crawler.development.command.meta.keyword.dunkhome;

import com.chance.cc.crawler.development.command.meta.keyword.CrawlerDomainKeywordCommand;
import com.chance.cc.crawler.meta.core.bean.crawler.CrawlerDomainKeys;

import java.io.*;

public class dunkhomeKeyword {
    private static final String DOMAIN = "dunkhome";
    private static final String SITE = "nike";
    private static final String path = "F:\\chance_work\\chance-crawler-development\\crawler-scripts-command\\src\\main\\java\\com\\chance\\cc\\crawler\\development\\command\\meta\\keyword\\dunkhome\\dunkhome_keyword.txt";

    private static final String HOST = "192.168.1.215";
    private static final int PORT = 9599;

    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(path)), "UTF-8"));
        String lineData = null;
        while ((lineData = bufferedReader.readLine()) != null){
            CrawlerDomainKeywordCommand crawlerDomainKeywordCommand = new CrawlerDomainKeywordCommand(HOST,PORT);

            CrawlerDomainKeys crawlerDomainKeys = new CrawlerDomainKeys();
            crawlerDomainKeys.setDomain(DOMAIN);
            crawlerDomainKeys.setSite(SITE);
            crawlerDomainKeys.setKeyword(lineData);
            crawlerDomainKeys.setStatus(0);
            crawlerDomainKeywordCommand.addOrUpdateKeys(crawlerDomainKeys);

            System.out.println(lineData);
        }
    }
}
